package com.tanhua.server.service;

import com.tanhua.domain.mongo.UserLocation;
import com.tanhua.dubbo.api.mongo.UserLocationApi;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {


    @Reference
    private UserLocationApi userLocationApi;


    /**
     * 保存当前地理位置
     * @param latitude
     * @param longitude
     * @param addrStr
     * @return
     */
    public ResponseEntity saveLocation(Double latitude, Double longitude, String addrStr) {

        //保存或者更新当前用户的地址位置
        userLocationApi.saveLocation(latitude, longitude, addrStr, UserHolder.getUserId());
        //返回响应
        return ResponseEntity.ok(null);
    }
}
